package com.changgou.page.listener;

import com.changgou.page.config.RabbitMQConfig;
import com.changgou.page.service.PageService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author zero
 * @date 2020/7/6
 */

@Component
public class PageListener {

    @Autowired
    private PageService pageService;

    @RabbitListener(queues = RabbitMQConfig.GOODS_DETAIL_QUEUE)
    public void receiveMessage(String spuId){
        System.out.println("接收到的商品id是:"+ spuId);

        pageService.generateItemPage(spuId);
    }

}
